home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.02 Feb 90 / FuzzyBrush source / FuzzyInit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-01  |  1.1 KB  |  54 lines  |  [TEXT/KAHL]

  1. /*
  2.  *  FuzzyInit.c
  3.  *    Linda McLennan
  4.  *  COPYRIGHT © 1989 Ventana Software
  5. */
  6.  
  7. #include    "BWit.h"
  8. #include    "Fuzzy.h"
  9.  
  10. FuzzyInit( tDataPtr, refCon )
  11.  
  12.     ToolDataPtr    tDataPtr;
  13.     Handle        *refCon;
  14.         
  15. {
  16.     MenuHandle        fuzzyMenu;
  17.     FuzzyDataPtr    fzDataPtr;
  18.  
  19.     /* set options */
  20.     tDataPtr->cursorType = resourceCursor;
  21.     tDataPtr->symmetry = autoSymmetry;
  22.     tDataPtr->autoPaint = noAutoPaint;            
  23.     tDataPtr->usesScratch = false;            
  24.     tDataPtr->usesConstrain = true;            
  25.     tDataPtr->changeFillPat = false;
  26.  
  27.     /* check if first time called */
  28.     if ( *refCon == nil )
  29.     {
  30.         /* allocate space for globals */
  31.         *refCon =
  32.             NewHandle( sizeof ( FuzzyData ) );
  33.  
  34.         /* get the menu, detach it */
  35.         /* and save the handle */
  36.         if ( *refCon != nil )
  37.         {
  38.             fuzzyMenu = GetMenu( tDataPtr->toolID );
  39.             if ( fuzzyMenu != nil )
  40.             {
  41.                 HNoPurge((Handle)fuzzyMenu); 
  42.                 DetachResource((Handle)fuzzyMenu);
  43.             } 
  44.     
  45.             HLock( *refCon );
  46.             fzDataPtr = (FuzzyDataPtr)**refCon;
  47.             fzDataPtr->theMenu = fuzzyMenu;
  48.             fzDataPtr->whichEffect = fuzzy;
  49.             fzDataPtr->brushSize = 16;
  50.             HUnlock( *refCon );                
  51.         }
  52.     }
  53.  }
  54.